<!--# layout("/common/layout.html",{"jsBase":"/js/customer/customerInfo/"}){ -->

<form class="layui-form layui-form-pane" id="addForm" enctype="multipart/form-data"  lay-filter="editform">
    <input type="hidden" name="customerId" id="customerId">

    <br>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">来源模块</label>
                <div class="layui-input-inline">
                    <input type="text" name="moduleName" id="moduleName" autocomplete="off" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">微信昵称</label>
                <div class="layui-input-inline">
                    <input type="text" name="wxUname" id="wxUname" autocomplete="off" class="layui-input" readonly>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">绑定手机号</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone" id="phone" autocomplete="off" class="layui-input" >
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">会员类型</label>
                <div class="layui-input-inline">
                    <select name="customerType" lay-verify="">
                        <option value="">请选择</option>
                        <option value="0">内部员工</option>
                        <option value="1">普通会员</option>
                    </select>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">真名</label>
                <div class="layui-input-inline">
                    <input type="text" name="customerName" id="customerName" autocomplete="off" class="layui-input"  lay-verify="required" >
                </div>
            </div>
            <div class="layui-inline">
            <label class="layui-form-label">住址</label>
				<div class="layui-input-inline" >
                    <input type="text" name="address" id="address" autocomplete="off" class="layui-input" >
				</div>
            </div>

        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">所在省份</label>
                <div class="layui-input-inline">
                    <layui:simpleDataSelect name="provinceId"  value="" data="${provinceList}"
                        attrId="provId" attrName="provName" layFilter="colFilter" id="provinceId"  laySearch="true"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">文理科</label>
                <div class="layui-input-inline">
                    <input type="radio" name="majorType" value="1" title="文科">
                    <input type="radio" name="majorType" value="2" title="理科" checked>
                </div>
            </div>

        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">是否为老师</label>
                <div class="layui-input-inline">
                    <input type="radio" name="isTeacher" value="1" title="是">
                    <input type="radio" name="isTeacher" value="0" title="否" checked>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">是否启用</label>
                <div class="layui-input-inline">
                    <input type="radio" name="custStatus" value="1" title="是">
                    <input type="radio" name="custStatus" value="0" title="否" checked>
                </div>
            </div>
        </div>
    </div>

    <layui:submitButtons id="addButton" />
</form>
<!--#} -->
<script>
    Common.initImage();
layui.define([ 'form', 'laydate', 'table','customerInfoApi'], function(exports) {
    var form = layui.form;
    var customerInfoApi = layui.customerInfoApi;
    var index = layui.index;
    var isNew = true;
    <!--# if(!(isEmpty(customerInfoJson))){  -->
    isNew = false;
    <!--# } -->
    var view = {
        init:function(){
            Lib.initGenrealForm($("#addForm"),form);
            this.initSubmit();
        },
        initSubmit:function(){
            $("#addButton").click(function(){
                form.on('submit(form)', function(){
                    customerInfoApi.saveForm(isNew,$('#addForm'),function(){
                        parent.window.dataReload();
                        Common.info("保存成功");
                        Lib.closeFrame();
                    });
                });
            });
            $("#addButton-cancel").click(function(){
                Lib.closeFrame();
            });
        }

    }
    view.init();
    <!--# if(!(isEmpty(customerInfoJson))){  -->
    var formJson = ${customerInfoJson};
    form.val("editform",formJson);
    $(".image-preview").each(function() {
        $(this).attr("src",formJson[$(this).attr("id")]);
    });
    <!--# } -->
});
</script>
